package com.zryc.shop.cms.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.zryc.shop.cms.entity.Subject;
import com.zryc.shop.cms.mapper.SubjectMapper;
import com.zryc.shop.cms.service.ISubjectService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.zryc.shop.ums.entity.Menu;
import org.springframework.stereotype.Service;
import org.springframework.util.StringUtils;

/**
 * <p>
 * 专题表 服务实现类
 * </p>
 *
 * @author zhaozhao
 * @since 2024-01-18
 */
@Service
public class SubjectServiceImpl extends ServiceImpl<SubjectMapper, Subject> implements ISubjectService {

    /**
     * 分页查询专题列表
     *
     * @param pageNum
     * @param pageSize
     * @param keyword
     * @return
     */
    @Override
    public Page<Subject> list(Integer pageNum, Integer pageSize, String keyword) {
        Page<Subject> page = new Page<>(pageNum, pageSize);
        QueryWrapper<Subject> wrapper = new QueryWrapper<>();
        if (!StringUtils.isEmpty(keyword)) {
            wrapper.like("title", keyword);
        }
        return page(page, wrapper);
    }
}
